-> root -> software -> ::software::ClamAV
ClamAV is probably the most popular FREE (as in free speech, not free beer) antivirus software for Linux and other operating systems. In this category, news, notes, ... about clamav. For more info, please take a look at http://www.clamav.com.

Writing a client for ClamAV clamd
[5]

Writing a client for the clamd daemon is usually a matter of a few lines of code: just connect to the daemon socket for each file you need to scan, issue the scanning command that best suit your needs, and that's it most of the times.

To avoid to open/close new connections with clamd continuosly, however, you can issue the SESSION clamd command, which allows a software to issue multiple commands on one, single, socket.

Beware, however, that clamd is able to recognize one, and only one command per packets it receives. If, after issueing the SESSION and STREAM command, for example, your client hangs, it's probably because the Linux Kernel joined the two different commands in one, single, packet.

The only solution we know about is to insert a sleep(1); between the write("SESSION"... and the write("STREAM"... command, hoping that a 1 second delay would be enough to avoid the nagle algorithm.

Note that we know no way to disable the nagle algorithm on Unix stream sockets, and afaik, there is no way to avoid the kernel joining the buffers but a small delay.

The problem is known to the clamav developers, but no solution has been proposed yet, mainly to avoid breaking compatibility with older clients.

Generated by CRON on 2012/02/14 at 06:26:35.